package com.demo.feign.controller;

import com.demo.feign.service.UserService;
import com.demo.feign.service.UserService1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;

    @Autowired
    private UserService1 userService1;

    @GetMapping("/getNameByUserId/feign/{id}")
    public String getNameByUserId(@PathVariable("id")int id){
        String nameByUserId = userService.getNameByUserId(id);
        System.out.println(nameByUserId);
        return nameByUserId;
    }
    @GetMapping("/getNameByUserId1/feign/{id}")
    public String getNameByUserId1(@PathVariable("id")int id){
        String nameByUserId = userService1.getNameByUserId(id);
        System.out.println(nameByUserId);
        return nameByUserId;
    }
}
